//
//  RNOLLoginViewModel.m
//  RongNiuOnline
//
//  Created by apple on 2018/4/27.
//  Copyright © 2018年 rongniu. All rights reserved.
//

#import "RNOLLoginViewModel.h"

@implementation RNOLLoginViewModel


- (instancetype)init
{
    self = [super init];
    if (self) {
     [self setup];
    }
    return self;
}

- (void)setup{
    ///聚合信号
    _enableLoginSignal = [RACSignal combineLatest:@[RACObserve(self, phoneNumber),RACObserve(self, password)]  reduce:^id(NSString *phoneNumber,NSString *password){
        return @([phoneNumber isMobileNumber] && (password.length >= 6 && password.length <= 20));
    }];
    
    _enableRegisterSignal = [RACSignal combineLatest:@[RACObserve(self, phoneNumber),RACObserve(self, verifyCode),RACObserve(self, password)] reduce:^id (NSString *phoneNum,NSString *verifyCode,NSString *password){
      return @([phoneNum isMobileNumber]&& verifyCode.length == 4 && (password.length >= 6 && password.length <= 20));
    }];
}





@end
